'use strict';
module.exports = {
  Query: {
    async user(root, { id }, ctx) {
      try {
        const res = await ctx.connector.user.fetchById(id);
        return res;
      } catch (error) {
        console.log('error-------', error);
      }
    },
    async userList(root, params, ctx) {
      try {
        const res = await ctx.connector.user.fetchByList(params);
        return res;
      } catch (error) {
        console.log('error-------', error);
      }
    },
  },
  Mutation: {
    async updateUserList(root, option, ctx) {
      const res = await ctx.connector.user.fetchUpdate(option);
      return res;
    },
    async addUser(root, option, ctx) {
      const res = await ctx.connector.user.fetchCreate(option);
      return res;
    },
  },
};
